package org.pub.fast.base.lock;

public class LockManagerImpl implements ILockManager{

	@Override
	public boolean acquireLock(String lockable, 
			String userID, String dsName) {
		return LockManagerDMO.getInstance().lockPK(lockable, userID, dsName);
	}

	@Override
	public boolean isLocked(String lockable,
			String dsName) {
		return LockManagerDMO.getInstance().isLocked(lockable, dsName);
	}

	@Override
	public boolean acquireBatchLock(String[] lockables, 
			String userID, String dsName) {
		return LockManagerDMO.getInstance().lockPK(lockables, userID, dsName);
	}

	@Override
	public void releaseLock(String lockable,String userID,
			String dsName) {
		LockManagerDMO.getInstance().releasePK(lockable, userID, dsName);
	}

	@Override
	public void releaseBatchLock(String[] lockables,
			String userID, String dsName) {
		LockManagerDMO.getInstance().releasePK(lockables, userID, dsName);		
	}

	@Override
	public void releaseUserLocks(String userID, String dsName) {
		LockManagerDMO.getInstance().releasePKByUser(userID, dsName);
	}

	@Override
	public void onJvmStart() {
	}

	@Override
	public LockableVO[] getAllLockVOs(String dsName) {
		// TODO Auto-generated method stub
		return LockManagerDMO.getInstance().getAllLockVOs(dsName);
	}

	@Override
	public LockableVO[] getUserLockVO(String userID, String dsName) {
		// TODO Auto-generated method stub
		return LockManagerDMO.getInstance().getUserLockVOs(userID, dsName);
	}

	@Override
	public boolean canLockPK(String lockable, String dsName) {
		return LockManagerDMO.getInstance().canLock(dsName, lockable);
	}

}
